#pragma once

#include "fm33le0xx_fl.h"

typedef struct {
    union {
        struct {
            uint32_t b: 8;
            uint32_t g: 8;
            uint32_t r: 8;
            uint32_t reserved: 8;
        };
        uint32_t value;
    };
} color_t;

typedef struct {
    color_t color;
    uint16_t diff_ms;   // 渐变时间
    uint16_t total_ms;  // 总时间 = 渐变时间 + 停留时间
    uint8_t is_last;
} frame_t;

typedef struct {
    const frame_t* list;
    color_t color_last;
    color_t color_now;
    uint32_t run_ms;
    uint8_t index;
    uint8_t count_total;
} frame_run_status_t;

#define FRAME_MAX_COUNT 20

void led_side_set_status(uint8_t enable);

void led_side_set_color(color_t color);

void led_side_fade_to_color(color_t color, uint32_t time_ms);
